package com.dily.study.demo.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dily.study.demo.entity.mybatisPlus.BigDataDemo;
import com.dily.study.demo.mapper.BigDataDemoMapper;
import org.apache.ibatis.session.ResultHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * Date: 2022-03-24 星期四
 * Time: 13:36
 * Author: Dily_Su
 * Remark:
 */

@Service
public class BigDataDemoService extends ServiceImpl<BigDataDemoMapper, BigDataDemo> {

    Logger logger = LoggerFactory.getLogger(BigDataDemoService.class);

    @Transactional
    public List<BigDataDemo> getAll() {
        List<BigDataDemo> list = new ArrayList<>();
        this.baseMapper.getAllRecord((ResultHandler<BigDataDemo>) resultContext -> {
            BigDataDemo bigDataDemo = resultContext.getResultObject();
            logger.error(String.valueOf(bigDataDemo));
            System.out.println(bigDataDemo);
        });
        return list;
    }
}
